import request from "@/utils/request";

const baseURL = "/official-website/unit/banner";

export type BannerDetail = {
  id: string;
  bannerName: string;
  bannerType: number; //banner类型;1.图片，2.视频
  bannerUrl: string;
  switchJump: number; //跳转开关;0:关闭,1:开启
  jumpPage: string; //banner跳转页面地址
  sortNo: number; //排序
};

// 根据bannerid获取banner详情
export const getBannerById = (id: string) =>
  request<Res<BannerDetail>>({
    url: `${baseURL}/get-banner-by-id`,
    method: "GET",
    params: { id },
  });

// banner分页查询
export const getBanner = (data: PageParams & { bannerName?: string; bannerType?: number }) =>
  request<Res<{ list: BannerDetail[]; total: number }>>({
    url: `${baseURL}/page`,
    method: "POST",
    data,
  });
